<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">
<ui:composition template="/pages/template/modelo.xhtml">
	<ui:define name="titulo">:: Friendzoone - Fotos ::</ui:define>
	<ui:define name="cabecalho">
		<div class="win-commandlayout win-ui-dark"
			style="background-color: #424251; height: 50px; float: left; width: 100%;">
			<div class="win-command">
				<h:graphicImage value="/resources/img/friendzone.png" />
			</div>
			<h:form>
				<h:commandLink actionListener="#{auth.logout}">
					<button class="win-command">
						<span class="win-commandicon win-commandring  icon-switch-2"></span>
					</button>
				</h:commandLink>
			</h:form>
		</div>
	</ui:define>
	<ui:define name="corpo">
		<h:form>
			 <p:poll interval="10" listener="#{mensagemHome.verificarMensagensParaEntrega}" update="painel" /> 
			<p:messages showDetail="true" showSummary="false" />
			<p:growl id="messages" showDetail="true" />
			<p:panel style="width:200px;height:400px;float:left;">
				<h:dataTable value="#{mensagemHome.pessoasOnline}" var="pessoa">
					<h:column>
						<div>
							<h:commandButton value="#{pessoa.nome}"
								action="#{mensagemHome.selecionar(pessoa)}">
								<f:ajax execute="@form" render="@all" />
							</h:commandButton>
							<br />
						</div>
					</h:column>
				</h:dataTable>
			</p:panel>
			<p:panel id="painel"
				style="font: 15px Tahoma; cursor: default; height: 400px; width: 600px; overflow: auto; background-color: #DFEDFE; padding-left: 10px; padding-right: 10px"
				onkeyup="Rolar();">
				<h:outputLabel value="#{mensagemHome.pessoaSelecionada.nome}"
					rendered="#{not empty mensagemHome.pessoaSelecionada.nome}" />
				<h:panelGrid columns="2">
					<h:dataTable value="#{mensagemHome.mensagens}" var="mensagemArmazenamento">
						<h:column>
							<h:outputLabel value="#{mensagemArmazenamento.dataArmazenamento}">
								<f:convertDateTime pattern="dd/MM/yyyy HH:mm:ss" />
							</h:outputLabel>
							<div>
								<h:outputLabel value="#{mensagemArmazenamento.textoArmazenametno}" />
							</div>
						</h:column>
					</h:dataTable>
				</h:panelGrid>
			</p:panel>
			<p:inputText value="#{mensagemHome.mensagem.mensagem}" size="100" />
			<h:commandButton value="Enviar" action="#{mensagemHome.enviar}" />
			<h:outputScript>
				$(document).ready(function() {
	   			   saveDraft();
				});
			</h:outputScript>
		</h:form>
	</ui:define>
</ui:composition>

</html>
